package cloud.seat.order.client;


import org.apache.seata.rm.tcc.api.BusinessActionContext;
import org.apache.seata.rm.tcc.api.TwoPhaseBusinessAction;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;

@FeignClient(name = "warehouse")
public interface WarehouseClient {

    @GetMapping("/deduct")
    @TwoPhaseBusinessAction(name = "TccWarehouseAction", commitMethod = "commit", rollbackMethod = "rollback")
    ResponseEntity<Boolean> prepare(BusinessActionContext actionContext);

    @GetMapping("/commit")
    boolean commit(BusinessActionContext actionContext);

    @GetMapping("/rollback")
    boolean rollback(BusinessActionContext actionContext);
}
